Polynomial arithmetic operations

ABSTRACT

Polynomial arithmetic instructions are provided in an instruction set architecture (ISA). A multiply-add-polynomial (MADDP) instruction and a multiply-polynomial (MULTP) instruction are provided.

CROSS-REFERENCE TO RELATED APPLICATIONS

[0001] This application is related to the following co-pending applications, each of which is being filed concurrently with this application and is incorporated by reference: (1) U.S. application Ser. No. ______, titled “Partial Bitwise Permutations”; (2) U.S. application Ser. No. ______, titled “Binary Polynomial Multiplier”; (3) U.S. application Ser. No. ______, titled “Configurable Instruction Sequence Generation”; and (4) U.S. application Ser. No. ______,titled “Extended Precision Accumulator”.

TECHNICAL FIELD

[0002] This invention relates to microprocessor instructions for performing polynomial arithmetic, and more particularly to microprocessor instructions for performing polynomial multiplications.

BACKGROUND

[0003] Reduced instruction set computer (RISC) architectures were developed as industry trends tended towards larger, more complex instruction sets. By simplifying instruction set designs, RISC architectures make it easier to use techniques such as pipelining and caching, thus increasing system performance.

[0004] RISC architectures usually have fixed-length instructions (e.g., 16-bit, 32-bit, or 64-bit), with few variations in instruction format. Each instruction in an instruction set architecture (ISA) may have the source registers always in the same location. For example, a 32-bit ISA may always have source registers specified by bits 16-20 and 21-25. This allows the specified registers to be fetched for every instruction without requiring any complex instruction decoding.

SUMMARY

[0005] Cryptographic systems (“cryptosystems”) are increasingly used to secure transactions, to encrypt communications, to authenticate users, and to protect information. Many private-key cryptosystems, such as the Digital Encryption Standard (DES), are relatively simple computationally and frequently reducible to hardware solutions performing sequences of XORs, rotations, and permutations on blocks of data. Public-key cryptosystems, on the other hand, may be mathematically more subtle and computationally more difficult than private-key systems.

[0006] While different public-key cryptography schemes have different bases in mathematics, they tend to have a common need for integer computation across very large ranges of values, on the order of 1024 bits. This extended precision arithmetic is often modular (i.e., operations are performed modulo a value range), and in some cases binary polynomial instead of twos-complement. For example, RSA public-key cryptosystems use extended-precision modular exponentiation to encrypt and decrypt information and elliptic curve cryptosystems use extended-precision modular polynomial multiplication.

[0007] Public-key cryptosystems have been used extensively for user authentication and secure key exchange, while private-key cryptography has been used extensively to encrypt communication channels. As the use of public-key cryptosystems increases, it becomes desirable to increase the performance of extended-precision modular arithmetic calculations.

[0008] In one general aspect, an instruction set architecture includes an instruction for performing polynomial arithmetic. The instruction includes one or more opcodes that identify the instruction as an instruction for performing a polynomial arithmetic operation. Additionally, the instruction identifies one or more registers. The instruction may be processed by performing the polynomial arithmetic operation using the identified registers.

[0009] Implementations may provide an instruction for performing binary polynomial addition, which may be implemented using a multiplier. The result of a polynomial arithmetic operation may be stored in one or more result registers. Polynomial arithmetic operations may include multiplication, where the contents of identified registers are multiplied together. Operations also may include polynomial multiplication-addition, where the contents of identified registers are multiplied together and then added to one or more result registers. The result registers may include a high-order register and a low-order register. Polynomial arithmetic operations may be performed on polynomials stored in registers. The polynomials may be encoded as a binary representation of coefficients.

[0010] The details of one or more implementations are set forth in the accompanying drawings and the description below. Other features and advantages will be apparent from the description and drawings, and from the claims.

DESCRIPTION OF DRAWINGS

[0011]FIG. 1 is a block diagram of an exemplary five-stage pipeline that may be used in a RISC architecture.

[0012]FIG. 2 is a block diagram of a processor core including an execution core and a multiply/divide unit.

[0013]FIGS. 3A and 3B are instruction encodings for exemplary instructions performing polynomial multiplication and addition.

DETAILED DESCRIPTION

[0014] Many public-key cryptosystems use extended-precision modular arithmetic to encrypt and decrypt data. For example, many elliptic curve (EC) cryptosystems heavily use binary polynomial multiplication and addition to encrypt and decrypt data. Performance of elliptic curve cryptosystems may be enhanced by modifying a programmable CPU multiplier to be responsive to newly defined instructions dedicated to polynomial operations.

[0015] When using elliptic curves defined over GF(2¹⁶³) (as recommended by the IEEE 1363-2000 standard), the main operation needed is multiplication over the field GF(2¹⁶³). Each of the 2¹⁶³ elements can be represented as a polynomial of degree at most 163 with coefficients equal to 0 or 1. In this representation, two elements may be added using a simple bitwise XOR and two polynomials, a(X) and b(X), may be multiplied by computing a(X)b(X) mod P(X), where the product a(X)b(X) is a 326-degree polynomial, and P(A) is an irreducible polynomial as specified by the IEEE 1363-2000 standard.

[0016] Polynomial multiplication has the same form as modular multiplication, ab mod p, over the integers, except that: (1) regular addition is replaced by an XOR; and (2) regular 32-bit multiplication is replaced by a 32-bit carry-free multiplication. Therefore, polynomial modular multiplication may be performed using shifts and XORs instead of shifts and adds.

[0017] Referring to FIG. 1, an exemplary microprocessor architecture that may be used to implement polynomial multiplication includes a five-stage pipeline in which an instruction may be issued each clock cycle and executed in a fixed amount of time, such as, for example, five clock cycles. The execution of each instruction is divided into five stages: instruction fetch (IF) stage 1001, register read (RD) stage 1002, arithmetic/logic unit (ALU) stage 1003, memory (MEM) stage 1004, and write back (WB) stage 1005. In the IF stage 1001, a specified instruction is fetched from an instruction cache. A portion of the fetched instruction is used to specify source registers that may be used in executing the instruction. In the read registers (RD) stage 1002, the system fetches the contents of the specified source registers. These fetched values may be used to perform arithmetic or logical operations in the ALU stage 1003. In the MEM stage 1004, an executing instruction may read/write memory in a data cache. Finally, in the WB stage 1005, values obtained by the execution of the instruction may be written back to a register.

[0018] Because some operations, such as floating point calculations and integer multiply/divide, cannot always be performed in a single clock cycle, some instructions merely begin execution of an instruction. After sufficient clock cycles have passed, another instruction may be used to retrieve a result. For example, when an integer multiply instruction takes five clock cycles, one instruction may initiate the multiplication calculation, and another instruction may load the results of the multiplication into a register after the multiplication has completed. If a multiplication has not completed by the time a result is requested, the pipeline may stall until the result is available.

[0019] Referring to FIG. 2, an exemplary RISC architecture is provided by way of example. The processor core 2000 (also referred to as “microprocessor core”) includes the following: an execution unit 2010, a multiply/divide unit (MDU) 2020, a system control coprocessor (CPO) 2030, a memory management unit 2040, a cache controller 2050, and a bus interface unit (BIU) 2060.

[0020] Execution unit 2010 is the primary mechanism for executing instructions within processor core 2000. Execution unit 2010 includes a register file 2011 and an arithmetic logic unit (ALU) 2012. In one implementation, the register file 2011 includes thirty-two 32-bit general-purpose registers that may be used, for example, in scalar integer operations and address calculations. The register file 2011, which includes two read ports and one write port, may be fully bypassed to minimize operation latency in the pipeline. ALU 2012 supports both logical and arithmetic operations, such as addition, subtraction, and shifting.

[0021] The MDU 2020 performs multiply and divide operations. In one implementation, the MDU 2020 includes a 32-bit by 16-bit (32×16) Booth-encoded multiplier (not shown), result-accumulation registers (HI register 2021 and LO register 2022), a divide state machine, and all multiplexers and control logic required to perform these functions. In one pipelined implementation, 32×16 multiply operations may be issued every clock cycle to MDU 2020, so that a 32-bit number may be multiplied by a 16-bit number every clock cycle. However, the result will not be available in the HI/LO registers (2021 and 2022) until the multiplication has finished. The result may be accessed with the instructions MFHI and MFLO. These instructions move results from the HI register 2021 and LO register 2022, respectively, to an indicated register. For example, “MFHI $7” moves the contents of the HI register 2021 to general purpose register $7.

[0022] Two instructions, multiply-add (MADD/MADDU) and multiply-subtract (MSUB/MSUBU), may be used to perform the multiply-add and multiply-subtract operations. The MADD instruction multiplies two numbers and then adds the product to the current contents of the HI register 2021 and the LO register 2022. The result then is stored in the HI/LO registers (2021 and 2022). Similarly, the MSUB instruction multiplies two operands and then subtracts the product from the HI register 2021 and the LO register 2022, storing the result in the HI/LO registers (2021 and 2022). The instructions MADD and MSUB perform operations on signed values. MADDU and MSUBU perform the analogous operations on unsigned values.

[0023] Referring to FIG. 3A, an exemplary instruction encoding of a multiply-polynomial (MULTP) instruction 3010 is provided. The MULTP instruction 3010 has two register fields, rs 3011 and rt 3012, that specify the source registers containing polynomials to be multiplied. After the multiplication is complete, the result is stored in the HI register 2021 and the LO register 2022. The MULTP instruction 3010 also may include one or more opcodes 3013 that identify the operation to be performed. In some implementations a portion of the instruction field, such as, for example, field 3014, may be unused.

[0024] In one implementation, the registers identified by rs 3011 and rt 3012 contain binary polynomials (i.e., the polynomial's coefficients are reduced modulo two). Thus, each coefficient is either a “1” or a “0”. The polynomials are encoded in a 32-bit register with each bit representing a polynomial coefficient. For example, the polynomial “x⁴+x+1” would be encoded as “10011” because the coefficients of x³ and X² are “0” and the remaining coefficients are “1”.

[0025] The MULTP instruction 3010 permits two polynomials to be multiplied. For example, (x⁴+x+1)(x+1)=x⁵+x⁴+x²+2x+1. Reducing the polynomial modulo two, yields x⁵+x⁴+x²+1. If the polynomials are encoded in the binary representation above, the same multiplication may be expressed as (10011)(11)=110101.

[0026] The sizes of the instruction and the operands may be varied arbitrarily; the 32-bit design described is merely by way of example. In a 32-bit implementation, a 32-bit word value stored in rs 3011 may be polynomial-basis multiplied by a 32-bit word value stored in rt 3012, treating both operands as binary polynomial values, to produce a 64-bit result. The low-order 32-bit word may be placed in LO register 2022, and the high-order 32-bit word result may be placed in HI register 2021. In some implementations, no arithmetic exceptions may occur. If the registers specified by rs 3011 and rt 3012 do not contain 32-bit sign-extended values, the result of the operation may be unpredictable.

[0027] Referring to FIG. 3B, an exemplary instruction encoding of a multiply-add-polynomial (MADDP) instruction 3020 is provided. The MADDP instruction 3020 has two parameter fields, rs 3021 and rt 3022, that specify the source registers containing polynomials to be multiplied and polynomial-basis added (XORed) to the contents of HI 2021 and LO 2022. After the multiplication and addition are complete, the result is stored in the HI register 2021 and the LO register 2022. The MADDP instruction 3020 also may include one or more opcodes 3023 that identify the operation to be performed. In some implementations, a portion of the instruction field, such as, for example, field 3024, may be unused.

[0028] The MADDP instruction 3020 performs multiplication as discussed above. Binary polynomial addition is analogous to a bitwise XOR. For example, the binary polynomial addition (x⁴x+1)+(x+1) gives x⁴+2x+2. Reducing the coefficients modulo 2 yields x⁴, which may be expressed as “10000”.

[0029] Similarly, the sizes of the instruction and the operands may be varied arbitrarily. In one implementation, a 32-bit word value stored in rs 3021 may be polynomial-basis multiplied by a 32-bit word value stored in rt 3022, treating both operands as binary polynomial values, to produce a 64-bit result. This result then may be polynomial-basis added to the contents of the HI register 2021 and the LO register 2022. The 64-bit result includes a low-order 32-bit word and a high-order 32-bit word. The low-order 32-bit word may be placed in LO register 2022, and the high-order 32-bit word result may be placed in HI register 2021. If the registers specified by rs 3021 and rt 3022 do not contain 32-bit sign-extended values, the result of the operation may be unpredictable.

[0030] In addition to polynomial arithmetic implementations using hardware (e.g., within a microprocessor or microcontroller), implementations also may be embodied in software disposed, for example, in a computer usable (e.g., readable) medium configured to store the software (i.e., a computer readable program code). The program code causes the enablement of the functions or fabrication, or both, of the systems and techniques disclosed herein. For example, this can be accomplished through the use of general programming languages (e.g., C, C++), hardware description languages (HDL) including Verilog HDL, VHDL, AHDL (Altera HDL) and so on, or other available programming and/or circuit (i.e., schematic) capture tools. The program code can be disposed in any known computer usable medium including semiconductor, magnetic disk, optical disk (e.g., CD-ROM, DVD-ROM) and as a computer data signal embodied in a computer usable (e.g., readable) transmission medium (e.g., carrier wave or any other medium including digital, optical, or analog-based medium). As such, the code can be transmitted over communication networks including the Internet and intranets.

[0031] It is understood that the functions accomplished and/or structure provided by the systems and techniques described above can be represented in a core (e.g., a microprocessor core) that is embodied in program code and may be transformed to hardware as part of the production of integrated circuits. Also, the systems and techniques may be embodied as a combination of hardware and software. Accordingly, other implementations are within the scope of the following claim. 

What is claimed is:
 1. In an instruction set architecture, an instruction for performing polynomial arithmetic, the instruction being part of the instruction set architecture and including: one or more opcodes identifying the instruction as an instruction for performing a polynomial arithmetic operation; and one or more register identifiers; wherein the instruction is processed by performing the polynomial arithmetic operation using the one or more register identifiers.
 2. The instruction of claim 1 wherein the polynomial arithmetic operation is binary polynomial addition.
 3. The instruction of claim 2 wherein the binary polynomial addition is performed using a multiplier.
 4. The instruction of claim 1 wherein the result of the polynomial arithmetic operation is stored in one or more result registers.
 5. The instruction of claim 4 wherein the polynomial arithmetic operation includes: multiplying the contents of the registers identified by the one or more register identifiers to obtain an intermediate value; and adding the contents of the one or more result registers to the intermediate value to obtain a result.
 6. The instruction of claim 5 wherein the result is stored in the one or more result registers.
 7. The instruction of claim 1 wherein the result of the polynomial arithmetic operation is stored in a high-order result register and a low-order result register.
 8. The instruction of claim 1 wherein the polynomial arithmetic operation is polynomial multiplication.
 9. The instruction of claim 8 wherein each register identified by the one or more register identifiers contains a polynomial.
 10. The instruction of claim 9 wherein each polynomial is encoded as a binary representation of coefficients.
 11. The instruction of claim 1 wherein the instruction set comprises a RISC instruction set.
 12. A method for performing polynomial arithmetic using an instruction, the method comprising: receiving an instruction, the instruction including: one or more opcodes identifying the instruction as an instruction for performing a polynomial arithmetic operation; and one or more register identifiers; and performing a polynomial arithmetic operation using the one or more register identifiers by processing the instruction.
 13. The method of claim 12 wherein performing the polynomial arithmetic operation comprises performing binary polynomial addition.
 14. The method of claim 13 wherein performing the binary polynomial addition comprises using a multiplier.
 15. The method of claim 12 further comprising storing the result of the polynomial arithmetic operation in one or more result registers.
 16. The method of claim 15 wherein peforming the polynomial arithmetic operation includes: multiplying the contents of the registers identified by the one or more register identifiers to obtain an intermediate value; and adding the contents of the one or more result registers to the intermediate value to obtain a result.
 17. The method of claim 16 further comprising storing the result in the one or more result registers.
 18. The method of claim 12 further comprising storing the result of the polynomial arithmetic operation in a high-order result register and a low-order result register.
 19. The method of claim 12 wherein performing the polynomial arithmetic operation comprises performing polynomial multiplication.
 20. The method of claim 19 wherein each register identified by the one or more register identifiers contains a polynomial.
 21. The method of claim 20 wherein each polynomial is encoded as a binary representation of coefficients.
 22. The method of claim 12 wherein the instruction is part of an instruction set, and the instruction set comprises a RISC instruction set.
 23. A computer-readable medium comprising a microprocessor core embodied in software, the microprocessor core including an instruction for performing polynomial arithmetic, the instruction including: one or more opcodes identifying the instruction as an instruction for performing a polynomial arithmetic operation; and one or more register identifiers; wherein the instruction is processed by performing the polynomial arithmetic operation using the one or more register identifiers.
 24. The computer-readable medium of claim 23 wherein the polynomial arithmetic operation is binary polynomial addition.
 25. The computer-readable medium of claim 24 wherein the binary polynomial addition is performed using a multiplier.
 26. The computer-readable medium of claim 23 wherein the result of the polynomial arithmetic operation is stored in one or more result registers.
 27. The computer-readable medium of claim 26 wherein the polynomial arithmetic operation includes: multiplying the contents of the registers identified by the one or more register identifiers to obtain an intermediate value; and adding the contents of the one or more result registers to the intermediate value to obtain a result.
 28. The computer-readable medium of claim 27 wherein the result is stored in the one or more result registers.
 29. The computer-readable medium of claim 23 wherein the result of the polynomial arithmetic operation is stored in a high-order result register and a low-order result register.
 30. The computer-readable medium of claim 23 wherein the polynomial arithmetic operation is polynomial multiplication.
 31. The computer-readable medium of claim 30 wherein each register identified by the one or more register identifiers contains a polynomial.
 32. The computer-readable medium of claim 31 wherein each polynomial is encoded as a binary representation of coefficients.
 33. The computer-readable medium of claim 23 wherein the instruction is part of an instruction set, and the instruction set comprises a RISC instruction set.
 34. In a public-key cryptosystem, a method for encrypting information with a public key, the method including an instruction for performing polynomial arithmetic, the instruction including: one or more opcodes identifying the instruction as an instruction for performing a polynomial arithmetic operation; and one or more register identifiers; wherein the instruction is processed by performing the polynomial arithmetic operation using the one or more register identifiers.
 35. The method of claim 34 wherein the polynomial arithmetic operation is binary polynomial addition.
 36. The method of claim 35 wherein the binary polynomial addition is performed using a multiplier.
 37. The method of claim 34 wherein the result of the polynomial arithmetic operation is stored in one or more result registers.
 38. The method of claim 37 wherein the polynomial arithmetic operation includes: multiplying the contents of the registers identified by the one or more register identifiers to obtain an intermediate value; and adding the contents of the one or more result registers to the intermediate value to obtain a result.
 39. The method of claim 38 wherein the result is stored in the one or more result registers.
 40. The method of claim 34 wherein the result of the polynomial arithmetic operation is stored in a high-order result register and a low-order result register.
 41. The method of claim 34 wherein the polynomial arithmetic operation is polynomial multiplication.
 42. The method of claim 41 wherein each register identified by the one or more register identifiers contains a polynomial.
 43. The method of claim 42 wherein each polynomial is encoded as a binary representation of coefficients.
 44. The method of claim 34 wherein the instruction is part of an instruction set, and the instruction set comprises a RISC instruction set.
 45. In a microprocessor, an instruction for performing polynomial arithmetic, the instruction including: one or more opcodes identifying the instruction as an instruction for performing a polynomial arithmetic operation; and one or more register identifiers; wherein the instruction is processed by performing the polynomial arithmetic operation using the one or more register identifiers.
 46. The instruction of claim 45 wherein the polynomial arithmetic operation is binary polynomial addition.
 47. The instruction of claim 46 wherein the binary polynomial addition is performed using a multiplier.
 48. The instruction of claim 45 wherein the polynomial arithmetic operation includes: multiplying the contents of the registers identified by the one or more register identifiers to obtain an intermediate value; and adding the contents of the one or more result registers to the intermediate value to obtain a result.
 49. The instruction of claim 45 wherein the polynomial arithmetic operation is polynomial multiplication.
 50. A microprocessor providing one or more instructions for performing polynomial arithmetic, the microprocessor including: an instruction store; an execution unit that fetches a microprocessor instruction from the instruction store and processes the fetched instruction; and a polynomial arithmetic unit used by the execution unit in processing the fetched instruction if the fetched instruction is one of the one or more instructions for performing polynomial arithmetic.
 51. The microprocessor of claim 50 wherein the microprocessor further comprises a multiply/divide unit.
 52. The microprocessor of claim 51 wherein the polynomial arithmetic unit is a component of the multiply/divide unit.
 53. The microprocessor of claim 50 wherein the polynomial arithmetic unit is operable to perform binary polynomial addition.
 54. The microprocessor of claim 50 wherein the polynomial arithmetic unit is operable to perform binary polynomial multiplication.
 55. The microprocessor of claim 50 further comprising a result register for storing a result from the polynomial arithmetic unit.
 56. The microprocessor of claim 55 wherein the polynomial arithmetic unit is operable to perform a binary polynomial multiplication-addition operation by performing a binary polynomial multiplication to determine an intermediate result and adding the intermediate result to the result register. 